Repository navigation
Test the Logger's promises: throwing, reporting, silent after close - #13
Merged
Merged
Conversation
Three behaviours the header promises about the Logger had no test: a logger that throws does not stop the sending thread, a logger may itself call report(), and once close() returns the logger is never called again, even by a sending thread close() gave up on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ThreadSanitizer found that a report() from inside the logger races with close() on TraceClient::shared_ (#14). The test now hands control back to the main thread before closing, so it checks only that a logger may report, and leaves the race to its own issue. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Self-review rubric (head 2nd commit, CI run 39592754832):
Judgment calls:
Verdict: ready to merge. This PR touches tests only and matches no do-not-auto-merge path. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage B — unit-test expansion (the
Logger's promises).Summary
Loggerthat no test checked. This PR adds tests for them; production code is unchanged:aLoggerThatThrowsDoesNotStopTheSendingThread: with every report answered 500, a logger that throws on each call still sees all three reports delivered and logged (Shared::log'scatch (...)).aLoggerMayItselfReport: a report issued from inside the logger, which runs on the sending thread, is queued and sent like any other and does not deadlock (thelogMutexcomment inShared).theLoggerIsNeverCalledOnceCloseReturns: whenclose(0.5)gives up on an in-flight request, the sending thread is left to finish on its own, and the logger hears nothing more onceclose()has returned (README: "Onceclose()returns, theLoggeris never called again").main()'stests[]table.<stdexcept>was added to the test's includes forstd::runtime_error.Test plan
make test(g++, C++11):53 tests, 0 failed checks(up from 50), run twice.make test STD=c++17:53 tests, 0 failed checks.shared->forgetLogger()removed fromclose(),theLoggerIsNeverCalledOnceCloseReturnsfails (expected [0] got [1]).Shared::log'scatch (...)narrowed tocatch (int), the suite aborts inaLoggerThatThrowsDoesNotStopTheSendingThread(terminate called after throwing an instance of 'std::runtime_error').linux,linux-libcurl,linux-sanitizers(thread; address,undefined),macos,windows. The sandbox did not allow sanitizer builds locally, so the TSan/ASan coverage of the new threaded tests comes from CI alone.No tracking issue: the gap was found during triage, by checking each README promise against
test/test_trace_client.cpp.Deferred
TRACE_CLIENT_CURLoverride ignored on Windows whenSystem32\curl.exeexists): skipped. The issue asks the owner to choose between honoring the override and documenting the current behavior. Either change also touches thecurl.exelookup, which is part of the process-spawn security boundary.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson